﻿package net.wangit.jdbc.table;


import java.util.Iterator;

import net.wangit.jdbc.database.Database;

public class PrimaryKey extends Constraint {
	public String sqlConstraintString(Database database) {
		StringBuffer buf = new StringBuffer(" primary key (");
		Iterator<Column> iter = getColumns().iterator();
		while (iter.hasNext()) {
			buf.append(((Column) iter.next()).getQuotedName(database));
			if (iter.hasNext()) {
				buf.append(", ");
			}
		}
		return buf.append(")").toString();
	}
}